package com.example.demo.business.bean.vo;

import com.example.demo.business.bean.entity.HVideo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class VideoItemVo {
    private String ids;
    //片名
    private String name;
    //更新时间
    private String updateTime;
    //图片
    private String img;
    //横屏图片
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String adImg1;
    //竖屏
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String adImg2;
    //是否是广告
    private boolean isAd;
    //广告链接
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String adUrl;
    //热度
    private float hot;
    //片长
    private String playTime;
    //是否Vip
    private boolean isVip;
    //用户是否收藏
    private boolean isCollection;

    private String code;
    //下载地址
    private String downUrl;
    //电影类型
    private int type;

    public void setImg(String img) {
        this.img = img;
        this.adImg1=img;
        this.adImg2=img;
    }

    public VideoItemVo(HVideo hVideo) {
        this.setName(hVideo.getName());
        this.setCollection(true);
        this.setHot(hVideo.getHot());
        this.setPlayTime(hVideo.getPlayTime());
        this.setVip(hVideo.getVip()!=0);
        this.setType(hVideo.getType());
        this.setImg(hVideo.getShowImg());
        this.setDownUrl(hVideo.getNormalVideoUrls());
        this.setIds(String.valueOf(hVideo.getId()));
    }
}
